package com.little.test.client.springboot;

import com.little.test.api.IHello2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class SpringBootApplicationController {

	@Autowired
	private IHello2 hello;

	@RequestMapping(value = "/testRpc", produces = {"application/json;charset=UTF-8"})
	public String index() {
		StringBuffer sb = new StringBuffer();
		 for(int i = 0;i<20;i++) {
			 sb.append(hello.doubleNum(i) + ":");
		 }
		 return  sb.toString();
	}



	public static void main(String[] args) {

	/*	SpringApplicationBuilder b = new SpringApplicationBuilder(SpringBootApplicationController.class);
		ConfigurableApplicationContext c = b.context();
		b.run(args);

		SpringApplication.run(SpringBootApplicationController.class,args);*/


		SpringApplication.run(SpringBootApplicationController.class, args);

/*		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(RpcConfig.class);
		IHello aa = (IHello) context.getBean("aa");
		IHello2 bb = (IHello2) context.getBean("bb");

		String hello1 = aa.sayHello("Rpc");
		Integer hello2 = bb.doubleNum(10);

		System.out.println("hello1:" + hello1 + " hello2 " + hello2);*/

	}

}
